import React from 'react';

import BaseExecuter from '../common/BaseExecuter';
import Constants from '../../common/Constants';

import DataManager from '../../datas/DataManager';

export default class ZahuopuExecuter extends BaseExecuter {
  execute(action) {
    switch (action.name) {
      case "ZHP_RequestPostsAction":
        this._requestPosts(action);
        break;
      case "ZHP_CreatePostAction":
        this._createPost(action);
        break;
      case "ZHP_RequestCommentListAction":
        this._requestCommentList(action);
        break;
      case "ZHP_RequestContentAction":
        this._requestContent(action);
        break;
      case "ZHP_SendCommentAction":
        this._sendComment(action);
        break;
      case "ZHP_SendSearchAction":
        this._sendSearch(action);
        break;
      default:
    }
  }

  //http://47.93.168.211:8080/dqapp/boards/1/posts/searched?key=11&page=11&page_size=10
  _sendSearch(action) {
    this._sendRequestCommon(action, "sendSearch");
  }

  _sendComment(action) {
    this._sendRequestCommon(action, "sendComment");
  }

  _requestContent(action) {
    this._sendRequestCommonResponse(action, "requestContent");
  }

  _requestCommentList(action) {
    this._sendRequestCommonResponse(action, "requestComment");
  }

  _requestPosts(action) {
    this._sendRequestCommon(action, "requestPosts");
  }

  _createPost(action) {
    this._sendRequestCommon(action, "createPost");
  }

  _getModuleType() {
    return Constants.MODULE_TYPE.ZAHUOPU;
  }
}
